package edu.sctu.practice.class02.hujie.cgs.assign04;

/**
 * Created by hp on 2015/12/4.
 */
public class Factorial {
    /**
     * Created by hp on 2015/12/3.
     * 1. 编写程序，计算大整数的阶乘。
     * 2. 编写程序，计算1+2+3…的前999999999项的和。
     */
    int b;
    int result = 1;

    //    Scanner put = new Scanner(System.in);
//    String a = put.next();
    public Factorial(int b) {
        this.b = b;
//      this.result = result;
    }

    public void test() {
        for (int i = b; i > 0; i--) {
            result = b * result;
            b = b - 1;
            System.out.println("分解：" + result);
        }
        System.out.println("最终结果：" + result);
    }

    public static void main(String args[]) {
        Factorial t = new Factorial(5);
        t.test();
    }
}
